/*
 * @Description: 
 * @Author: changqing
 * @Date: 2021-08-16 16:13:36
 * @LastEditTime: 2021-08-16 20:07:36
 * @LastEditors: changqing
 * @Usage: 
 */
var {Observable} = require('rxjs');
const observable = new Observable(subscriber => {
  subscriber.next('observable execute');
  setTimeout(() => {
    subscriber.complete();
  }, 1000);
});
 

const observer = {
  next(x) { console.log('got value ' + x); },
  error(err) { console.error('something wrong occurred: ' + err); },
  complete() { console.log('done'); }
}
console.log('just before subscribe');
observable.subscribe(observer);
console.log('just after subscribe');

// const { range } = require('rxjs');
// const { map, filter } = require('rxjs/operators');

// range(1, 200).pipe(
//   filter(x => x % 2 === 1),
//   map(x => x + x)
// ).subscribe(x => console.log(x));